package Base;

import com.fasterxml.jackson.annotation.JsonInclude;

import java.io.Serializable;

/**
 * API接口统一返回的模板
 *
 * Created by Botao.Liao on 2015-9-10.
 */
public class GResponse<T> implements Serializable {
    private static final long serialVersionUID = 5132407674044022634L;
    /**
     * 0表示成功返回，非零由各应用自行定义
     */
    private int code = 0;
    /**
     * 失败时，错误原因的简单英文描述
     */
    private String message = "success";
    /**
     * 执行成功后返回的结果
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private T data;

    public GResponse() {
    }

    public GResponse(T data) {
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
